# from django.templatetags.static import static
# from django.urls import reverse
#
# from jinja2 import Environment
#
#
# def environment(**options):
#     env = Environment(**options)
#     env.globals.update({
#         'static': static,# 配置static方法可以快速找到对应的静态文件
#         'url': reverse,#使用反解析,可根据路由快速找到他的路径
#     })
#     return env

# 配置jinjia2引擎

from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse

from jinja2 import Environment


def environment(**options):
    env = Environment(**options)
    env.globals.update({
        'static': staticfiles_storage.url,
        'url': reverse,
    })
    return env